/**
 * LogQueue.java
 * 版权所有(C) 2013
 * 创建者:cuiran 2013-12-2 下午1:57:33
 */
package com.ghyf.mplay.net.log;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

import com.ghyf.mplay.util.LogUtil;

/**
 * 日志队列
 * @author cuiran
 * @version 1.0.0
 */
public class PlayLogQueue {
	private static final String TAG = "LogQueue";  
	private static int queueSize = 1000;
	private static BlockingQueue<LogData> queue = new ArrayBlockingQueue<LogData>(queueSize);
	
	/**
	 * 取出数据<br>
	 * 2013-12-2 下午1:59:56
	 * @return
	 *
	 */
	public static LogData getLogData(){
		LogData vo = null;
		try {
			vo = queue.take();
		} catch (InterruptedException e) {
			LogUtil.e(TAG, "取数据出错",e);
		}
		return vo;
	}
	/**
	 * 添加数据<br>
	 * 2013-12-2 下午2:00:58
	 * @param data
	 *
	 */
	public static void addLogData(LogData data){
		
		try {
			 queue.put(data);
		} catch (InterruptedException e) {
			LogUtil.e(TAG, "添加数据出错",e);
		}
		
	}
}
